package com.zcxk.common;

public class Response extends DTO {

  private static final long serialVersionUID = 1L;

  private boolean success;

  private int code;

  private String errMessage;

  public boolean isSuccess() {
    return success;
  }

  public void setSuccess(boolean success) {
    this.success = success;
  }


  public int getCode() {
    return code;
  }


  public void setCode(int code) {
    this.code = code;
  }


  public String getErrMessage() {
    return errMessage;
  }


  public void setErrMessage(String errMessage) {
    this.errMessage = errMessage;
  }


  @Override
  public String toString() {
    return "Response [success=" + success + ", code=" + code + ", errMessage=" + errMessage + "]";
  }

  public static Response buildFailure(int errCode, String errMessage) {
    Response response = new Response();
    response.setSuccess(false);
    response.setCode(errCode);
    response.setErrMessage(errMessage);
    return response;
  }

  public static Response buildSuccess() {
    Response response = new Response();
    response.setSuccess(true);
    return response;
  }

}
